package com.glx.learn_spring.learn_spring_03_bean_instance;

import com.glx.learn_spring.learn_spring_03_bean_instance.dao.IOrderDao;
import com.glx.learn_spring.learn_spring_03_bean_instance.factory.OrderDaoFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author haoli
 * @create 2022/11/30 12:52
 */
public class AppForInstanceOrder {
    public static void main(String[] args) {
        // 通过静态工厂创建对象
        //IOrderDao orderDao = OrderDaoFactory.getInstance();
        //orderDao.save();

        // 让 Ioc 容器通过 静态工创建的 bean
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        IOrderDao orderDao2 = ctx.getBean("orderDao", IOrderDao.class);
        orderDao2.save();
    }
}
